<!doctype html>
<html dir="ltr" lang="en-US">
	<?php get_header('head'); ?>
	<body>
		<?php get_header('nav'); ?>
		<section class="row" id="featured_content">
			<?php
				// get latest featured article
				query_posts('category_name=features&posts_per_page=2');
				
				$first_featured = '<div class="sixcol">';
				$rest_featured = '<div class="threecol">';
				
				$i = 0;
				while (have_posts()) : the_post();
					if ($i > 0)
						echo $rest_featured;
					else
						echo $first_featured;
					echo '<h1><span id="featured_caption">featured</span> <a href="'.get_permalink().'">', get_the_title(), '</a></h1>';
					echo '<div id="feature_thumb_container"><a href="'.get_permalink().'">'; the_post_thumbnail('featured-thumb'); echo '</a></div>';
					echo '</div>';
					$i++;
				endwhile;
				
				// Reset for below loop
				wp_reset_query();
			?>
			<div class="threecol last">
				<?php
					// get latest featured article
					query_posts('category_name=issues&posts_per_page=1');
					
					while (have_posts()) : the_post();
						echo '<h1><span id="featured_caption">latest issue</span> <a href="'.get_permalink().'">', get_the_title(), '</a></h1>';
						echo '<div id="feature_thumb_container"><a href="'.get_permalink().'">'; the_post_thumbnail('issue-thumb'); echo '</a></div>';
					endwhile;
					
					// Reset for below loop
					wp_reset_query();
				?>
			</div>
			<!--
			<div class="fivecol last">
				<h2>Tasty new content</h2>
				<ul>
					<?php
						// display anchor link list of latest articles
						
						// each link jumps to article preview on the index page
						while (have_posts()) : the_post();
							echo '<li><a href="#', the_ID(), '">', the_title(), '</a></li>';
						endwhile;
						
						// Reset for below loop
						wp_reset_query();
					?>
				</ul>
			</div>
			-->
		</section>
		<div class="row">
			<h3 id="new"><a href="#new">Tasty new content...</a></h3>
		</div>
		<section id="category_posts">
			<?php
			
				// exlcude issues from appearing in news feed
				/*
				$issue_cat_id = get_term_by('name', 'issues', 'category');
				$issue_cat_id = $issue_cat_id->term_id;
								
				query_posts("cat=-$issue_cat_id");
				*/
							
				while (have_posts()) : the_post();
				
					echo '<div class="post row" id="', the_ID(), '">';					
						category_preview();
					echo '</div>';
						
				endwhile;
								
				echo '<div class="row"><p class="twelvecol last" id="nextprev">'; posts_nav_link(); echo '</p></div>';
			?>
		</section>
		<script type="text/javascript" src="<?php bloginfo('template_directory') ?>/js/image_width.js"></script>
		<?php get_footer(); ?>
	</body>
</html>